<!DOCTYPE html>
<html lang="en">
<head>
    {include file="Public/header"}
</head>
<body>
<div class="ibox">
    <div class="ibox-title">
        <h2 class="title_color text-center">请选择节点</h2>
    </div>
    <div class="ibox-content">
        <form action="" method="post">
            <table class="table">
                <tr>
                    <td style="width:20%;">
                        <label for="">节点</label>
                    </td>
                    <td>
                        <select name="node" id="">
                            <option value="">请选择</option>
                            {volist name="data.nextNodes" id="row"}
                            <option value="{$row.nodeId}">{$row.nodeName}</option>
                            {/volist}
                        </select>
                    </td>
                </tr>
                <tr>
                    <td></td>
                    <td>
                        <input type="hidden" name="type" value="2">
                        <input type="hidden" name="data" value='{:json_encode($data)}'>
                        <input type="hidden" name="spyj" value='{$spyj}'>
                        <input type="hidden" name="nodeId" value="{:request()->post('nodeId')}">
                        <input type="submit" value="提交">
                    </td>
                </tr>
            </table>
        </form>
    </div>
</div>
</body>
{include file="Public/footer"}
<script src="__STATIC__/layout/js/plugins/suggest/bootstrap-suggest.min.js"></script>
<script>
    $(function () {
        $('#Author').bsSuggest({
            url: '{:url("bs/users")}',
            effectiveFields: ["id", "login_name"],
            searchFields: [ "login_name"],
            effectiveFieldsAlias: {login_name: "名称"},
            ignorecase: true,
            showHeader: true,
            showBtn: false,     //不显示下拉按钮
            delayUntilKeyup: true, //获取数据的方式为 firstByUrl 时，延迟到有输入/获取到焦点时才请求数据
            idField: "id",
            keyField: "login_name",
            clearable: true
        }).on('onDataRequestSuccess', function (e, result) {
            console.log('onDataRequestSuccess: ', result);
        }).on('onSetSelectValue', function (e, keyword) {
            $('#Author_queding').find('.inin').html(keyword.key)
            $('#Author_queding').find('.inin').data('id',keyword.id)
            $('#Author_queding').show()
            $('#Author_input').hide()
            $('#Author_queding').find('input').val(keyword.id)
        }).on('onUnsetSelectValue', function () {
            console.log("onUnsetSelectValue");
        });

        //关闭办理人选择
        $('#Author_queding .close').click(function () {
            $(this).closest('#Author_queding').hide().find('.inin').html('')
            $(this).closest('#Author_queding').hide().find('input').val('')
            $('#Author_input').show().find('input').val('')
        })

        //弹窗选择办理人
        $('#selectAuthor').on('click',function(){
            top.layer.open({
                type: 2,
                title: '&nbsp;',
                shadeClose: true,
                shade: false,
                maxmin: true, //开启最大化最小化按钮
                area: ['800px', '500px'],
                content: '{:url("open/users2")}',
                btn:['确定','关闭'],
                yes:function (i,o) {
                    var a = $(o).find('iframe').contents()

                    var id =  a.find("#renyuan").val();
                    var name =  a.find("#renyuanname").val();
                    if(id){
                        var jxs_queding = $('#Author_queding')
                        var jxs_input = $('#Author_input')
                        jxs_queding.find('.inin').html(name)
                        jxs_queding.find('.inin').data('id',id)
                        jxs_queding.show()
                        jxs_input.hide()
                        jxs_queding.find('input').val(id)

                    }

                    top.layer.close(i)
                }
            })
            return false
        })
    })
</script>
</html>